<template>
  <div class="detail">
    <Header />
    <div class="detail-content">
      <div class="detail-content-top">
        <div style="position: relative;">
          <div class="thing-infos-view">
            <div class="thing-infos">
              <div class="thing-img-box">
                <img :src="detailData.cover">
              </div>
              <div class="thing-info-box">
                <div class="thing-state">
                  <span class="state hidden-sm">信息状态</span>
                  <span class="thing-name">有效</span>
                </div>
                <div style="display: flex; align-items: center; gap: 10px;">
                  <h1 class="thing-name">{{ detailData.title }}</h1>
                  <div class="rating-stars">
                    <span v-for="star in 5" :key="star" class="star">
                      <img :src="star <= Math.round(detailData.avgScore || 0) ? start1 : start2" class="star-icon"
                        :class="{ 'filled': star <= Math.round(detailData.avgScore || 0) }" />
                    </span>
                    <span class="rating-text">{{ (detailData.avgScore || 0).toFixed(1) }}</span>
                  </div>
                </div>
                <span>
                  <span class="a-price-symbol">￥：</span>
                  <span class="a-price" style="font-style: 35px;">{{ detailData.price }}&nbsp;/时</span>
                </span>
                <div class="translators flex-view">
                  <span>科目：</span>
                  <span class="name"> {{ detailData.courseName }} </span>
                </div>
                <div class="translators flex-view">
                  <span>性别：</span>
                  <span class="name">{{ detailData.sex }}</span>
                </div>
                <div class="translators flex-view">
                  <span>年龄：</span>
                  <span class="name">{{ detailData.age }}岁</span>
                </div>
                <div class="translators flex-view">
                  <span>地区：</span>
                  <span class="name">{{ detailData.location }}</span>
                </div>
                <div class="translators flex-view">
                  <span>电话：</span>
                  <span class="name">{{ detailData.mobile }}</span>
                </div>
                <div class="flex-view">
                  <button class="buy-btn" @click="showChatWindow = true">
                    <img :src="addIconSrc" style="width: 18px; margin-right: 6px;" />

                    <span>立即联系</span>
                  </button>

                  <button class="buy-btn" @click="showOrderWindow = true" style="margin-left: 10px;">
                    <img :src="shopIcon" style="width: 18px; margin-right: 6px;" />
                    <span>下单预约</span>
                  </button>
                </div>

                <!-- 下单弹窗 -->
                <div v-if="showOrderWindow" class="order-modal-mask" @click.self="showOrderWindow = false">
                  <div class="order-modal">
                    <div class="modal-header">
                      <h3>课程预约</h3>
                      <span class="close-btn" @click="showOrderWindow = false">×</span>
                    </div>
                    <div class="modal-body">
                      <div class="form-item">
                        <label>每日课时（小时）</label>
                        <input v-model="orderForm.hoursPerDay" type="number" min="1" @input="calculateTotal" />
                      </div>
                      <div class="form-item">
                        <label>总天数</label>
                        <input v-model="orderForm.days" type="number" min="1" @input="calculateTotal" />
                      </div>
                      <div class="form-item">
                        <label>预约时间</label>
                        <a-date-picker v-model:value="orderForm.startTime" :disabled-date="disabledDate" show-time
                          format="YYYY-MM-DD HH:mm" value-format="YYYY-MM-DD HH:mm"
                          :getCalendarContainer="trigger => trigger.parentNode" style="width: 100%" />
                      </div>
                      <div class="form-item">
                        <label>总金额</label>
                        <span class="total-amount">￥{{ orderForm.totalAmount.toFixed(2) }}</span>
                      </div>

                    </div>
                    <div class="modal-footer">
                      <button class="confirm-btn" @click="submitOrder">立即结算</button>
                    </div>
                  </div>
                </div>



              </div>
            </div>
            <div class="thing-counts hidden-sm">
              <div class="count-item flex-view pointer" @click="addToWish">
                <div class="count-img">
                  <img :src="wantIcon" />
                </div>
                <div class="count-box flex-view">
                  <div class="count-text-box">
                    <span class="count-title">加入心愿单</span>"
                  </div>
                  <div class="count-num-box">
                    <span class="num-text">{{ detailData.wishCount }}</span>
                  </div>
                </div>
              </div>
              <div class="count-item flex-view pointer" @click="collect">
                <div class="count-img">
                  <img :src="recommendIcon">
                </div>
                <div class="count-box flex-view">
                  <div class="count-text-box">
                    <span class="count-title">收藏</span>
                  </div>
                  <div class="count-num-box">
                    <span class="num-text">{{ detailData.collectCount }}</span>
                  </div>
                </div>
              </div>
              <div class="count-item flex-view" @click="share">
                <div class="count-img">
                  <img :src="shareIcon">
                </div>
                <div class="count-box flex-view">
                  <div class="count-text-box">
                    <span class="count-title">分享</span>
                  </div>
                  <div class="count-num-box">
                    <span class="num-text"></span>
                    <img :src="weiboShareIcon">
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="detail-content-bottom">
        <div class="thing-content-view flex-view">
          <div class="main-content">
            <div class="order-view main-tab">
              <span class="tab" :class="{ 'tab-select': selectTabIndex === 0 }" @click="selectTab(0)">简介</span>
              <span class="tab" :class="{ 'tab-select': selectTabIndex === 1 }" @click="selectTab(1)">评论</span>
              <span class="tab-underline" :style="{ left: tabUnderLeft + 'px' }"></span>
            </div>
            <div v-if="selectTabIndex === 0" class="thing-intro">
              <p class="text">{{ detailData.description }}</p>
            </div>
            <div v-else-if="selectTabIndex === 1" class="thing-comment">
              <div class="title">发表新的评论</div>
              <div class="publish flex-view">
                <img :src="userStore.user_avatar
                  ? BASE_URL + '/api/staticfiles/avatar/' + userStore.user_avatar
                  : avatarIcon" class="mine-img">
                <input placeholder="说点啥...." class="content-input" ref="commentRef" />
                <button class="send-btn" @click="sendComment">发送</button>
              </div>
              <div class="tab-view flex-view">
                <div class="count-text">共有{{ commentData.length }}条评论</div>
                <div class="tab-box flex-view">
                  <span :class="{ 'tab-select': order === 'recent' }" @click="sortCommentList('recent')">最新</span>
                  <div class="line"></div>
                  <span :class="{ 'tab-select': order === 'hot' }" @click="sortCommentList('hot')">热门</span>
                </div>
              </div>
              <div class="comments-list">
                <div v-for="(item, index) in commentData" :key="index" class="comment-item">
                  <div class="flex-item flex-view">
                    <img :src="item.avatar ? BASE_URL + '/api/staticfiles/avatar/' + item.avatar : avatarIcon"
                      class="avator" />
                    <div class="person">
                      <div class="name">{{ item.username }}</div>
                      <div class="time">{{ item.commentTime }}</div>
                    </div>
                    <div class="float-right">
                      <span @click="like(item.id)">点赞</span>
                      <span class="num">{{ item.likeCount }}</span>
                    </div>
                  </div>
                  <p class="comment-content">{{ item.content }}</p>
                </div>
              </div>
            </div>
          </div>
          <div class="recommend">
            <div class="title">热门推荐</div>
            <div class="things" :class="{ 'active': index < 2 }">
              <div v-for="(item, index) in recommendData" :key="index" class="thing-item thing-item"
                @click="handleDetail(item)">
                <div class="img-view">
                  <img :src="item.cover" />
                </div>
                <div class="info-view">
                  <h3 class="thing-name">{{ item.title }}</h3>
                  <span>
                    <span class="a-price-symbol">￥：</span>
                    <span class="a-price">{{ item.price }}</span>
                    &nbsp;
                    <span class="location-text">{{ item.location }}</span>
                  </span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <Footer />
    <!-- 聊天窗口 -->
    <div v-if="showChatWindow" class="chat-window-mask" @click.self="showChatWindow = false">
      <div class="chat-window">
        <ChatBox :target-user-id="detailData.userId" :target-user-name="detailData.title"
          @close="showChatWindow = false" />
      </div>
    </div>
  </div>
</template>
<script setup>
import { message, Modal } from "ant-design-vue";
import Header from '/@/views/index/components/header.vue'
import Footer from '/@/views/index/components/footer.vue'
import {
  AddIcon,
  WantIcon,
  RecommendIcon,
  ShareIcon,
  WeiboShareIcon,
  AvatarIcon,
  Shop,
  Start1,
  Start2
} from '/@/assets';
import {
  detailApi,
  listApi as listThingList,
} from '/@/api/thing'
import { listThingCommentsApi, createApi as createCommentApi, likeApi } from '/@/api/comment'
import { wishApi } from '/@/api/thingWish'
import { collectApi } from '/@/api/thingCollect'
import { BASE_URL } from "/@/store/constants";
import { useRoute, useRouter } from "vue-router/dist/vue-router";
import { useUserStore } from "/@/store";
import { getFormatTime } from "/@/utils";
import ChatBox from './components/ChatBox.vue'; // 引入聊天窗口组件
import { createApi, payApi } from '/@/api/order';
import dayjs from 'dayjs';

components: { ChatBox }

const router = useRouter()
const route = useRoute()
const userStore = useUserStore();

// 定义一个变量来存储导入的图片资源
const addIconSrc = AddIcon;
const wantIcon = WantIcon;
const recommendIcon = RecommendIcon;
const shareIcon = ShareIcon;
const weiboShareIcon = WeiboShareIcon;
const avatarIcon = AvatarIcon;
const shopIcon = Shop;
const start1 = Start1;
const start2 = Start2;

//聊天
const showChatWindow = ref(false);
const currentUserId = computed(() => userStore.userInfo.id); // 假设Vuex存储了用户信息


let thingId = ref('')
let detailData = ref({})
let tabUnderLeft = ref(6)
let tabData = ref(['简介', '评论'])
let selectTabIndex = ref(0)

let commentData = ref([])
let recommendData = ref([])
let sortIndex = ref(0)
let order = ref('recent') // 默认排序最新

let commentRef = ref()

onMounted(() => {
  thingId.value = route.query.id.trim()
  getThingDetail()
  getRecommendThing()
  getCommentList()
})

const selectTab = (index) => {
  selectTabIndex.value = index
  tabUnderLeft.value = 6 + 54 * index
}

const getThingDetail = () => {
  detailApi({ id: thingId.value }).then(res => {
    detailData.value = res.data
    detailData.value.cover = BASE_URL + '/api/staticfiles/image/' + detailData.value.cover
  }).catch(err => {
    message.error('获取详情失败')
  })
}
const addToWish = () => {
  let userId = userStore.user_id
  if (userId) {
    wishApi({ thingId: thingId.value, userId: userId }).then(res => {
      message.success(res.msg)
      getThingDetail()
    }).catch(err => {
      console.log('操作失败')
    })
  } else {
    message.warn('请先登录')
  }
}
const collect = () => {
  let userId = userStore.user_id
  if (userId) {
    collectApi({ thingId: thingId.value, userId: userId }).then(res => {
      message.success(res.msg)
      getThingDetail()
    }).catch(err => {
      console.log('收藏失败')
    })
  } else {
    message.warn('请先登录')
  }
}
const share = () => {
  let content = '分享一个非常好玩的网站 ' + window.location.href
  let shareHref = 'http://service.weibo.com/share/share.php?title=' + content
  window.open(shareHref)
}
const handleOrder = (detailData) => {
  console.log(detailData)
  const userId = userStore.user_id

  if (userId) {
    Modal.info({
      title: '联系方式',
      content: '家教联系电话：' + detailData.mobile,
      onOk() {
      },
    });
  } else {
    message.warn("请先登录！")
  }
}
const getRecommendThing = () => {
  listThingList({ sort: 'recommend' }).then(res => {
    console.log(res.data);
    res.data.forEach((item, index) => {
      if (item.cover) {
        item.cover = BASE_URL + '/api/staticfiles/image/' + item.cover
      }
    })
    console.log(res)
    recommendData.value = res.data.slice(0, 6)
  }).catch(err => {
    console.log(err)
  })
}
const handleDetail = (item) => {
  // 跳转新页面
  let text = router.resolve({ name: 'detail', query: { id: item.id } })
  window.open(text.href, '_blank')
}
const sendComment = () => {
  console.log(commentRef.value)
  let text = commentRef.value.value.trim()
  console.log(text)
  if (text.length <= 0) {
    return
  }
  commentRef.value.value = ''
  let userId = userStore.user_id
  if (userId) {
    createCommentApi({ content: text, thingId: thingId.value, userId: userId }).then(res => {
      getCommentList()
    }).catch(err => {
      console.log(err)
    })
  } else {
    message.warn('请先登录！')
    router.push({ name: 'login' })
  }
}
const like = (commentId) => {
  likeApi({ id: commentId }).then(res => {
    getCommentList()
  }).catch(err => {
    console.log(err)
  })
}
const getCommentList = () => {
  listThingCommentsApi({ thingId: thingId.value, order: order.value }).then(res => {
    // console.log(res.data); // 打印返回的评论数据
    res.data.forEach(item => {
      item.commentTime = getFormatTime(item.commentTime, true)
    })
    commentData.value = res.data
  }).catch(err => {
    console.log(err)
  })
}
const sortCommentList = (sortType) => {
  if (sortType === 'recent') {
    sortIndex.value = 0
  } else {
    sortIndex.value = 1
  }
  order.value = sortType
  getCommentList()
}

const showChat = ref(false);

const openChat = () => {
  showChat.value = true;
};

const closeChat = () => {
  showChat.value = false;
};

// 订单弹窗相关数据
const showOrderWindow = ref(false);
const orderForm = reactive({
  hoursPerDay: 0,
  days: 1,
  totalAmount: 0
});

// 计算总金额
const calculateTotal = () => {
  const price = parseFloat(detailData.value.price) || 0;
  orderForm.totalAmount = price * orderForm.hoursPerDay * orderForm.days;
};

// 初始化时计算一次
onMounted(() => {
  calculateTotal();
});

// 时间禁用函数
const disabledDate = (current) => {
  return current && current < dayjs().startOf('day');
};
// 提交订单
const submitOrder = async () => {
  if (orderForm.hoursPerDay < 1 || orderForm.days < 1) {
    message.error('请输入有效的课时和天数');
    return;
  }

  if (!orderForm.startTime) {
    message.error('请选择预约时间');
    return;
  }


  // try {
  const orderData = {
    thingId: detailData.value.id,
    userId: userStore.user_id,
    hoursPerDay: orderForm.hoursPerDay,
    days: orderForm.days,
    totalAmount: orderForm.totalAmount,
    courseStartTime: orderForm.startTime,
    teacherName: detailData.value.title,
    subject: detailData.value.courseName,

  };
  const createResponse = await createApi(orderData);

  // await createApi(orderData); // 调用后端创建订单接口

  // 2. 获取创建的订单ID（假设接口返回数据中包含 order.id）
  if (!createResponse?.data?.id) { // [!code focus]
    throw new Error('订单创建失败：未返回有效订单ID'); // [!code focus]
  } // [!code focus]
  const orderId = createResponse.data.id;

  // 3. 调用支付接口
  const payResponse = await payApi({ orderId });
  message.success('下单成功！');
  showOrderWindow.value = false;
  // } catch (error) {
  //   message.error('下单失败，请重试');
  // }




};

</script>
<style scoped lang="less">
.hide {
  display: none;
}

.detail-content {
  display: flex;
  flex-direction: column;
  width: 1100px;
  margin: 4px auto;
}

.flex-view {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;

}

.hidden-lg {
  display: none !important;
}

.thing-infos-view {
  display: flex;
  margin: 89px 0 40px;
  overflow: hidden;

  .thing-infos {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: flex;
  }

  .mobile-share-box {
    height: 38px;
    background: transparent;
    padding: 0 16px;
    margin: 12px 0;
    font-size: 0;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;

    .state {
      width: 64px;
      height: 24px;
      line-height: 24px;
      background: rgba(70, 132, 226, .1);
      border-radius: 2px;
      font-weight: 500;
      font-size: 12px;
      color: #4684e2;
      text-align: center;
    }

    .share-img {
      background: #fff;
      width: 38px;
      height: 38px;
      border-radius: 50%;
      text-align: center;

      img {
        position: relative;
        top: 4px;
        width: 24px;
      }
    }
  }

  .thing-img-box {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 235px;
    flex: 0 0 235px;
    margin: 0 40px 0 0;

    img {
      width: 220px;
      height: 250px;
      display: block;
      background-size: cover;
      object-fit: cover;
      border-radius: 8px;
    }
  }

  .thing-info-box {
    text-align: left;
    padding: 0;
    margin: 0;
  }

  .thing-state {
    height: 26px;
    line-height: 26px;

    .state {
      font-weight: 500;
      color: #4684e2;
      background: rgba(70, 132, 226, .1);
      border-radius: 2px;
      padding: 5px 8px;
      margin-right: 16px;
    }

    span {
      font-size: 14px;
      color: #152844;
    }
  }

  .thing-name {
    line-height: 32px;
    margin: 16px 0;
    color: #0F1111 !important;
    //font-size: 15px !important;
    font-weight: 400 !important;
    font-style: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
  }

  .translators,
  .authors {
    line-height: 18px;
    font-size: 14px;
    margin: 8px 0;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;

    .name {
      color: #315c9e;
      white-space: normal;
    }
  }

  .tags {
    position: absolute;
    bottom: 20px;
    margin-top: 16px;

    .category-box {
      color: #152844;
      font-size: 14px;

      .title {
        color: #787878;
      }
    }
  }

  .thing-counts {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 235px;
    flex: 0 0 235px;
    margin-left: 20px;
  }

  .pointer {
    cursor: pointer;
  }

  .count-item {
    height: 64px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    cursor: pointer;
  }

  .count-img {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 32px;
    flex: 0 0 32px;
    margin-right: 24px;
    font-size: 0;

    img {
      width: 100%;
      display: block;
    }
  }

  .count-box {
    position: relative;
    border-bottom: 1px solid #cedce4;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    height: 100%;
  }

  .count-text-box {
    font-size: 0;

    .count-title {
      color: #152844;
      font-weight: 600;
      font-size: 16px;
      line-height: 18px;
      display: block;
      height: 18px;
    }
  }

  .count-num-box {
    font-weight: 600;
    font-size: 20px;
    line-height: 24px;
    color: #152844;
  }
}

.buy-btn {
  cursor: pointer;
  display: block;
  background: #4684e2;
  border-radius: 4px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  height: 36px;
  line-height: 36px;
  width: 110px;
  outline: none;
  border: none;
  margin-top: 18px;
}

.buy-btn img {
  width: 12px;
  margin-right: 2px;
  vertical-align: middle;
}

.buy-btn span {
  vertical-align: middle;
}

.buy-way {
  overflow: hidden;

  .title {
    font-weight: 600;
    font-size: 18px;
    height: 26px;
    line-height: 26px;
    color: #152844;
    margin-bottom: 12px;
  }
}

.thing-content-view {
  margin-top: 40px;
  padding-bottom: 50px;
}

.main-content {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;

  .text {
    color: #484848;
    font-size: 16px;
    line-height: 26px;
    padding-left: 12px;
    margin: 11px 0;
    white-space: pre-wrap;
  }
}

.main-tab {
  border-bottom: 1px solid #cedce4;
}

.order-view {
  position: relative;
  color: #6c6c6c;
  font-size: 14px;
  line-height: 40px;

  .title {
    margin-right: 8px;
  }

  .tab {
    margin-right: 20px;
    cursor: pointer;
    color: #5f77a6;
    font-size: 16px;
    cursor: pointer;
  }

  .tab-select {
    color: #152844;
    font-weight: 600;
  }

  .tab-underline {
    position: absolute;
    bottom: 0;
    left: 84px;
    width: 16px;
    height: 4px;
    background: #4684e2;
    -webkit-transition: left .3s;
    transition: left .3s;
  }
}

.recommend {
  -webkit-box-flex: 0;
  -ms-flex: 0 0 235px;
  flex: 0 0 235px;
  margin-left: 20px;

  .title {
    font-weight: 600;
    font-size: 18px;
    line-height: 26px;
    color: #152844;
    margin-bottom: 12px;
  }

  .things {
    border-top: 1px solid #cedce4;
    height: 700px;
    /* 固定高度 */
    overflow-y: scroll;
    /* 允许滚动 */
    scrollbar-width: none;
    /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none;
    /* IE 和 Edge 隐藏滚动条 */
    padding-right: 20px;
    /* 增加右边距 */
    margin-right: -20px;
    /* 负边距抵消 padding */
    padding: 10px;
    /* 添加内边距，使内容与容器边缘保持距离 */



    .thing-item {
      min-width: 255px;
      max-width: 255px;
      position: relative;
      flex: 1;
      margin-right: 20px;
      height: fit-content;
      overflow: hidden;
      margin-top: 26px;
      margin-bottom: 36px;
      padding-bottom: 24px;
      border-bottom: 1px #e1e1e1 solid;
      cursor: pointer;
      border-radius: 12px;
      /* 添加圆角 */

      .img-view {
        //background: #f3f3f3;
        //text-align: center;
        height: 200px;
        width: 255px;
        //border: 1px #f3f3f3 solid;


        img {
          height: 200px;
          width: 255px;
          overflow: hidden;
          margin: 0 auto;
          background-size: contain;
          object-fit: contain;
        }
      }

      .info-view {
        //background: #f6f9fb;
        overflow: hidden;
        padding: 0 16px;

        .thing-name {
          line-height: 32px;
          margin-top: 12px;
          color: #0F1111 !important;
          font-size: 15px !important;
          font-weight: 400 !important;
          font-style: normal !important;
          text-transform: none !important;
          text-decoration: none !important;
        }

        .price {
          color: #ff7b31;
          font-size: 20px;
          line-height: 20px;
          margin-top: 4px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .translators {
          color: #6f6f6f;
          font-size: 12px;
          line-height: 14px;
          margin-top: 4px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }

    .thing-item:hover {
      transform: translateY(-5px);
      /* 悬停时向上移动 */
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      /* 悬停时阴影加深 */
    }

    .things::-webkit-scrollbar {
      display: none;
      /* 隐藏滚动条 */
    }

    .things::-webkit-scrollbar-track {
      background: #f1f1f1;
      /* 滚动条轨道颜色 */
      border-radius: 4px;
    }

    .things::-webkit-scrollbar-thumb {
      background: #888;
      /* 滚动条滑块颜色 */
      border-radius: 4px;
    }

    .things::-webkit-scrollbar-thumb:hover {
      background: #555;
      /* 滚动条滑块悬停颜色 */
    }


  }
}

.flex-view {
  display: flex;
}

.thing-comment {
  .title {
    font-weight: 600;
    font-size: 14px;
    line-height: 22px;
    height: 22px;
    color: #152844;
    margin: 24px 0 12px;
  }

  .publish {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;

    .mine-img {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 40px;
      flex: 0 0 40px;
      margin-right: 12px;
      border-radius: 50%;
      width: 40px;
      height: 40px;
    }

    .content-input {
      -webkit-box-flex: 1;
      -ms-flex: 1;
      flex: 1;
      background: #f6f9fb;
      border-radius: 4px;
      height: 32px;
      line-height: 32px;
      color: #484848;
      padding: 5px 12px;
      white-space: nowrap;
      outline: none;
      border: 0px;
    }

    .send-btn {
      margin-left: 10px;
      background: #4684e2;
      border-radius: 4px;
      -webkit-box-flex: 0;
      -ms-flex: 0 0 80px;
      flex: 0 0 80px;
      color: #fff;
      font-size: 14px;
      text-align: center;
      height: 32px;
      line-height: 32px;
      outline: none;
      border: 0px;
      cursor: pointer;
    }
  }

  .tab-view {
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    font-size: 14px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin: 24px 0;

    .count-text {
      color: #484848;
      float: left;
    }

    .tab-box {
      color: #5f77a6;
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;

      .tab-select {
        color: #152844;
      }

      span {
        cursor: pointer;
      }
    }

    .line {
      width: 1px;
      height: 12px;
      margin: 0 12px;
      background: #cedce4;
    }
  }
}


.comments-list {
  .comment-item {
    .flex-item {
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      padding-top: 16px;

      .avator {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 40px;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        margin-right: 12px;
        border-radius: 50%;
        cursor: pointer;
      }

      .person {
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
      }

      .name {
        color: #152844;
        font-weight: 600;
        font-size: 14px;
        line-height: 22px;
        height: 22px;
        cursor: pointer;
      }

      .time {
        color: #5f77a6;
        font-size: 12px;
        line-height: 16px;
        height: 16px;
        margin-top: 2px;
      }

      .float-right {
        color: #4684e2;
        font-size: 14px;
        float: right;

        span {
          margin-left: 19px;
          cursor: pointer;
        }

        .num {
          color: #152844;
          margin-left: 6px;
          cursor: auto;
        }
      }
    }
  }
}

.comment-content {
  margin-top: 8px;
  color: #484848;
  font-size: 14px;
  line-height: 22px;
  padding-bottom: 16px;
  border-bottom: 1px dashed #cedce4;
  margin-left: 52px;
  overflow: hidden;
  word-break: break-word;
}

.infinite-loading-container {
  clear: both;
  text-align: center;
}

.a-price-symbol {
  top: -0.5em;
  font-size: 18px;
  color: #ea5d5c;
}

.a-price {
  color: #ea5d5c;
  font-size: 20px;
}

.location-text {
  color: #7f8c8d;
  font-size: 14px;
}

.chat-window-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}


/* 订单弹窗样式 */
.order-modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.ant-picker {
  width: 100%;
  height: 32px;
  border-radius: 4px;
}

.ant-picker-panel {
  right: 0 !important;
  left: auto !important;
  transform: translateX(0) !important;
}

.order-modal {
  background: white;
  width: 400px;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;

    h3 {
      margin: 0;
    }

    .close-btn {
      cursor: pointer;
      font-size: 24px;

      &:hover {
        color: #4684e2;
      }
    }
  }

  .form-item {
    margin-bottom: 15px;

    label {
      display: block;
      margin-bottom: 5px;
      color: #152844;
    }

    input {
      width: 100%;
      padding: 8px;
      border: 1px solid #cedce4;
      border-radius: 4px;

      &:focus {
        outline: none;
        border-color: #4684e2;
      }
    }

    .total-amount {
      font-size: 18px;
      color: #ff7b31;
      font-weight: bold;
    }
  }

  .modal-footer {
    text-align: right;
    margin-top: 20px;

    .confirm-btn {
      background: #4684e2;
      color: white;
      border: none;
      padding: 8px 20px;
      border-radius: 4px;
      cursor: pointer;

      &:hover {
        opacity: 0.9;
      }
    }
  }
}

.rating-stars {
  display: inline-flex;
  align-items: center;
  margin-left: 40px;
}

.star {
  display: inline-block;
  margin-right: 2px;
}

.star-icon {
  width: 25px;
  height: 25px;
  vertical-align: middle;
  transition: all 0.3s;
}

.filled {
  filter: brightness(1.2);
}

.rating-text{
  font-size: 17px;
  margin-left: 10px;
}
</style>